<%-- 
    Document   : socketCliente
    Created on : 20/01/2013, 09:48:16 PM
    Author     : johnny
--%>

<%-- 
    Document   : doConsulta
    Created on : 27/05/2012, 05:08:56 AM
    Author     : johnny
--%>

<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@page import="org.json.simple.JSONObject"%>
<%@page import="org.json.simple.JSONArray"%>
<%@ page import="java.io.*, java.net.*" %>
<%
    
        try{
            int character;
            Socket socket = new Socket("127.0.0.1", 1111);

            InputStream inSocket = socket.getInputStream();
            OutputStream outSocket = socket.getOutputStream();

            String str = "NICK johnny!\n";
            byte buffer[] = str.getBytes();
            outSocket.write(buffer);

            while ((character = inSocket.read()) != -1) {
                out.print((char) character);
            }

            socket.close();
        }
        catch(java.net.ConnectException e){
        }
%>